/*
 *  ECE552H1 F Assignment 1
 *  File Name: mbq1a.c
 *  Author: Mustafa Abbas
 *  Description:
 *      A microbenchmark that executes a fixed number of multiplies
 *      to test out the hazards caused by the multiply.
 */

/* this microbenchmark executes 1000000 multiplies */
#define BENCHMARK_SIZE 1000

int main () {
    int iter1, iter2;
    int x;

    /* do BENCHMARK_SIZE * BENCHMARK_SIZE multiplies and store them in x
       in the assembly, you will see the mult instruction in a loop, here
       is the assembly:
       --------
       $L9:
       lw	$2,16($fp)
       lw	$3,20($fp)
       mult	$2,$3
       mflo	$2
       sw	$2,24($fp)
       --------
       */

    for (iter1 = 0; iter1 < BENCHMARK_SIZE; iter1++) {
        for (iter2 = 0; iter2 < BENCHMARK_SIZE; iter2++) {
            x = iter1 * iter2;
        }
    }

    return 0;
}
